package com.czd.support.enums;


import com.czd.base.model.EnumVI;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Author: GuSi
 * Create: GuSi (14-7-8 16:00)
 * Description:
 * To change this template use File | Settings | File Templates.
 */
public enum OrganizationTypeEnum {
	公司,
	区域,
	门店,
	分行;

	public static int getActualValue(OrganizationTypeEnum organizationTypeEnum){
		switch (organizationTypeEnum){
			case 公司:
				return 0;
			case 区域:
				return 3;
			case 门店:
				return 6;
			case 分行:
				return 9;
			default:
				return 0;
		}
	}

	public static String getString(int index){
		switch (index){
			case 0:
				return 公司.toString();
			case 3:
				return 区域.toString();
			case 6:
				return 门店.toString();
			case 9:
				return 分行.toString();
			default:
				return "";
		}
	}
	public static List<EnumVI> getEnumsList() {
		List<EnumVI> list = new ArrayList<>();
		for(OrganizationTypeEnum s: values())
		{
			if(s.ordinal() != 0){
				list.add(new EnumVI(s.name(),OrganizationTypeEnum.getActualValue(s)));
			}
		}
		return list;
	}

	public static int getLastType(int currentType){
		if(currentType == 0){
			return currentType;
		}
		return currentType - 3;
	}
}
